<template>
  <div>
    <el-form-item :prop="item.name || ''" :label="item.label" v-bind="item.formItemProps || {}" ref="el-form-item">
      <el-radio-group v-model="mvalue" v-bind="item.radioGroupProps || {}">
        <el-radio :label="obj.value" v-for="(obj) in (item.options || [])" v-bind="opt">{{obj.label}}</el-radio>
      </el-radio-group>
    </el-form-item>
  </div>
</template>

<script>
  import { objectAssign } from "../../utils/common";
  import Required from "../validMixins/Required";

  export default {
    name: "PopoRadio",
    props: {
      value: { type: [String] },
      item: { type: Object },
      formData: { type: Object },
    },
    mixins: [Required],
    data() {
      return {
        mvalue: this.value,
        opt: {},
        options: [],
      };
    },
    watch: {
      mvalue(val) {
        this.$emit("input", val);
      },
    },
    created() {
      // console.log( "input", this);
      var opt = objectAssign({}, this.item.props);
      this.opt = opt;
      this.options = this.item.options;
    },
    methods: {},
  };
</script>
